﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFSQLiteOneToManay
{
    public class InspResultMapping : BaseDomainMapping<InspRecord>
    {
        public override void Init()
        {
            ToTable("InspRecord");
            HasKey(l => l.ID);
            Property(l => l.BatchID).HasMaxLength(200).IsRequired();//设置Name属性长度为200 并且是必填
            Property(l => l.EquipID).HasMaxLength(200).IsOptional();
            Property(l => l.ErrCode).HasMaxLength(200).IsRequired();
            Property(l => l.ModelID).HasMaxLength(200).IsRequired();
            Property(l => l.LineNO).HasMaxLength(200).IsRequired();
            Property(l => l.ModelID).HasMaxLength(200).IsRequired(); 
            Property(l => l.OperatorID).HasMaxLength(200).IsRequired(); 
            Property(l => l.PannelID).HasMaxLength(200).IsRequired();
            //配置InspResult和GroupResult的一对多关系，InspResult对GroupResult是可选的，外键GID，并设置为级联删除
            HasMany(t => t.Groups).WithRequired(t => t.IR).HasForeignKey(t => t.GID).WillCascadeOnDelete();
        }
    }
}
